package com.lagou.concurrent.demo;

import java.util.concurrent.Phaser;

/**
 * 使用phaser代替CyclicBarrier
 */
public class Main1 {
    public static void main(String[] args) {
        Phaser phaser = new Phaser(5);

        for (int i = 0; i < 5; i++) {
            new MyThread("线程-" + (i + 1), phaser).start();
        }

        phaser.awaitAdvance(0);
        System.out.println("运行结束");
    }
}

